<?php
@include("connect.php");

//分页
$username = $_GET['username'];

// $username = 'aaaa123';

// $id = 5;

$obj = [];


$sql = "select * from user where username='$username'";

// 默认只会转第一条数据
$res = mysqli_query($conn, $sql);
$arr = mysqli_fetch_array($res);
// 

$data = [];


if ($arr) {
    $data['id'] = $arr['id'];
    $data['email'] = $arr['email'];
    $data['tel'] = $arr['tel'];
    $data['name'] = $arr['username'];

    $obj['status'] = false;
    $obj['msg'] = '数据请求成功';
    $obj['data'] = $data;
} else {
    $obj['status'] = false;
    $obj['msg'] = '服务器错误';
}

echo (json_encode($obj, JSON_UNESCAPED_UNICODE));
